home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / utilities / text / tec10.lha / Examples / trap.tec < prev    next >
Encoding:
Text File  |  1994-05-24  |  1.2 KB  |  57 lines

  1. % Some sort of bug trap by MJSoft. This filter doesn't do anything useful,
  2. % but it should test every dark corner of TEC except the buffering mechanism,
  3. % which is tested by test1/test2/test3.
  4. % Use: TEC trap trap FROM infile TO outfile (yes, run it *twice*)
  5. % infile: zYXAacmNobabxm!AQaAWabcdef aAa.A.pQrst.AAaA.bBb.BbB.
  6. % outfile: ^1*1)@#|#|string\n}a}b}@}m}!#|Qq#|>»abcdef«12345?}
  7. % stdout: This is TRAP.TEC, version 1.0000\nThis is TRAP.TEC version 1.0000\n
  8. %         Pass 2 is running
  9.  
  10. global
  11.     nocase    'Z' 'y' glob2
  12.     case    'x' put '@'
  13.         'X' put ')'
  14.  
  15. init:    msg "This is TRAP.TEC, version 1.0000\n"
  16.     start
  17.  
  18. str:    clr cat ">»" gather
  19. gather:    ' ' '\t' '\n' '\r' cat "«" puts clr gath_2
  20.     else add
  21. gath_2:    '.' dottest
  22.     else add
  23. dottest:    switch
  24.         "aaa" xaaa
  25.         "a" xa
  26.         "pqrst" xpqr
  27.     else cswitch
  28.         "AAaA" xaaaa
  29.         "bBb" xbbb
  30.     else put '?' start
  31. xaaa: put '1' qwe
  32. xa: put '2' qwe
  33. xpqr: put '3' qwe
  34. xaaaa: put '4' qwe
  35. xbbb: put '5' qwe
  36. qwe: clr gath_2
  37.  
  38. start:        eof 'b' eof bgot
  39.     nocase    'a' put '#' ; case 'c' put "string\n"
  40.         'Q' copy qqq
  41.         'W' str
  42.         '*' pass2
  43.         else
  44.  
  45. bgot: put '}'
  46.     '!' >'!' start
  47.     else copy
  48.  
  49. glob2:    put "*1" start
  50.  
  51. qqq: use start
  52.     'a' put 'q'
  53.  
  54. pass2: put '^' ; msg "Pass 2 is running\n"  pass2a
  55. pass2a:    '#' copy >'|'
  56.     else copy
  57.